-- 锁的key
local lockKey = KEYS[1]
-- 当前线程标识
local currentThreadId = ARGV[1]

-- 锁里面的线程标识
local lockThreadId = redis.call('get',lockKey)
-- 比较当前线程标识和锁里面的线程标识是否一致
if(currentThreadId == lockThreadId) then
    -- 释放锁
    return redis.call('del',lockKey)
end
return 0
